<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <title>AI 面试评分</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f2f5;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding-top: 50px;
            min-height: 100vh;
            margin: 0;
        }
        .container {
            background-color: #fff;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            width: 80%;
            max-width: 800px;
        }
        h2 {
            text-align: center;
            color: #333;
            margin-bottom: 20px;
        }
        .form-container {
            margin-bottom: 30px;
        }
        .file-upload-box {
            border: 2px dashed #ccc;
            border-radius: 8px;
            padding: 20px;
            text-align: center;
            cursor: pointer;
            transition: border-color 0.3s;
        }
        .file-upload-box:hover {
            border-color: #007bff;
        }
        .button {
            display: block;
            width: 100%;
            padding: 12px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 18px;
            margin-top: 20px;
            transition: background-color 0.3s;
        }
        .button:hover {
            background-color: #0056b3;
        }
        .result-box {
            margin-top: 20px;
            padding: 20px;
            background-color: #e9ecef;
            border-radius: 8px;
        }
        .error-message {
            color: #dc3545;
            text-align: center;
            margin-bottom: 15px;
        }
        .logout {
            position: absolute;
            top: 20px;
            right: 20px;
        }
        .logout button {
            background: none;
            color: #007bff;
            border: none;
            cursor: pointer;
            font-size: 16px;
            text-decoration: underline;
        }
        .logout button:hover {
            color: #0056b3;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="logout">
        <!-- 登出表单，使用 POST 方法提交 -->
        <form th:action="@{/logout}" method="post">
            <!-- 必须包含 CSRF 令牌 -->
            <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
            <button type="submit">登出</button>
        </form>
    </div>
    <h2>AI 面试评分系统</h2>

    <div th:if="${error}" class="error-message">
        <p th:text="${error}"></p>
    </div>

    <div class="form-container">
        <!-- 修正表单action为正确的URL -->
        <form method="post" enctype="multipart/form-data" th:action="@{/interview/upload}">
            <div class="file-upload-box">
                <label for="resumeFile">选择简历文件 (TXT, PDF, DOCX)</label>
                <input type="file" id="resumeFile" name="resumeFile" required>
            </div>
            <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
            <button type="submit" class="button">开始面试</button>
        </form>
    </div>

    <!-- 移除result显示，因为结果会跳转到result页面 -->
</div>
</body>
</html>